package SwingController;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

import SwingModel.CmsUser;
import SwingView.CmsMainView;
import SwingView.CmsPageSelector.CmsPage;

public class ALHome implements ActionListener {

	private CmsMainView mainView;	
	private CmsUser user;			
	private JComboBox courseCBox; 	//course list drop down menu
	
	//---------------------------------------------------------
	//CONSTRUCTOR:
	//---------------------------------------------------------	
	public ALHome(CmsMainView mainView, CmsUser user){
		this.mainView = mainView;
		this.user = user;
		this.courseCBox = mainView.getAccountPanel().getJcbCourseList();
	}

	//---------------------------------------------------------
	//PERFORMING ACTION:
	//---------------------------------------------------------		
	@Override
	public void actionPerformed(ActionEvent e){
		user.setSelectedCourseIndex(-1); // (-1) == no course is selected
		courseCBox.setSelectedIndex(0); //Set the combo box to display "Select Course"
		mainView.displayHomePage();
	}
}
